# 构建 WASM 包

Write-Host "Building WASM package..."
wasm-pack build --target bundler --release --scope krwu --out-name index

if ($LASTEXITCODE -eq 0) {
    Write-Host ""
    Write-Host "✓ Build successful"
    Write-Host "✓ Generated scoped package: @krwu/img-resize-wasm"
    Write-Host ""
    Write-Host "Fixing package.json..."
    node fix-package-json.cjs
    
    if ($LASTEXITCODE -eq 0) {
        Write-Host ""
        Write-Host "✓ All done!"
        Write-Host ""
        Write-Host "Next steps:"
        Write-Host "  cd pkg"
        Write-Host "  npm publish --access public"
    } else {
        Write-Host ""
        Write-Host "✗ Failed to fix package.json"
        exit 1
    }
} else {
    Write-Host ""
    Write-Host "✗ Build failed"
    exit 1
}
